<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let random = Math.floor(Math.random()*10)+1
        console.log(random);
        for(i=0;i<=8;i++){
            if(i===8){
                alert('你太菜了，下次再来吧！')
                break
            }
            let num=prompt('请输入1——10之间的整数')
            if(num===random){
                alert('猜对了，你真棒！！')
                break
            }else{
                alert('不是呢，请再来一遍')
            }
        }
    </script>
</body>
</html>